package com.gtw.modules.sys.service.impl;

import com.gtw.modules.dao.TbActivityCommodityDao;
import com.gtw.modules.entity.TbActivityCommodity;
import com.gtw.modules.sys.service.SysTbActivityCommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by wuye on 2018/3/2.
 */
@Service
public class SysTbActivityCommodityServiceImpl implements SysTbActivityCommodityService {

    @Autowired
    private TbActivityCommodityDao activityCommodityDao;

    @Override
    public TbActivityCommodity queryObject(Integer id){
        return activityCommodityDao.queryObject(id);
    }

    @Override
    public List<TbActivityCommodity> queryList(Map<String, Object> map){
        return activityCommodityDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map){
        return activityCommodityDao.queryTotal(map);
    }

    @Override
    public void save(TbActivityCommodity activityCommodity){
        activityCommodityDao.insert(activityCommodity);
    }

    @Override
    public void update(TbActivityCommodity activityCommodity){
        activityCommodityDao.updateByPrimaryKey(activityCommodity);
    }

    @Override
    public void delete(Integer id){
        activityCommodityDao.delete(id);
    }

    @Override
    public void deleteBatch(Integer[] ids){
        activityCommodityDao.deleteBatch(ids);
    }

    @Override
    public List<TbActivityCommodity> foundByActivityId(Integer id) {
        return activityCommodityDao.foundByActivityId(id);
    }

    @Override
    public TbActivityCommodity foundByActivityidCommodityid(Map<String, Object> map) {
        return activityCommodityDao.foundByActivityidCommodityid(map);
    }

    /**
     * 减少活动销量
     *
     * @param aid
     * @param commoditynumber
     */
    @Override
    public void subStore(Integer aid, Integer commoditynumber) {
        activityCommodityDao.subStore(aid,commoditynumber);
    }

    /**
     * 增加活动销量
     *
     * @param aid
     * @param commoditynumber
     */
    @Override
    public void addStore(Integer aid, Integer commoditynumber) {
        activityCommodityDao.addStore(aid,commoditynumber);
    }
}
